package com.wxd.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.mapper.TGetserialMapper;
import com.guigu.mapper.TMealsMapper;
import com.guigu.pojo.TMeals;
import com.guigu.pojo.TMealsType;
import com.lc.util.Getserial;
import com.wxd.service.TMealsService;
import com.wxd.vo.PageVo;
import com.wxd.vo.TMealstype;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class TMealsServiceImpl implements TMealsService {
    @Autowired
    TMealsMapper tMealsMapper;

    @Resource
    private Getserial getserial;

    @Resource
    private TGetserialMapper tGetserialMapper;

    @Override
    public PageInfo<TMealstype> findEmpPage(PageVo<TMealstype> pageVo) {
        PageHelper.startPage(pageVo.getPage(),pageVo.getPageSize());
        PageInfo<TMealstype> pp=new PageInfo<TMealstype>(this.tMealsMapper.findByPagination(pageVo.getEntityClass()));
        return pp;
    }

    @Override
    public List<TMealsType> QueryTMeals() {
        return this.tMealsMapper.queryTMeals();
    }

    @Override
    public void Insert(TMeals tMeals) {
        tMeals.setCode(this.getserial.returnSpid());
        this.tMealsMapper.insert(tMeals);
    }

    @Override
    public void UpdateByPrimaryKey(TMeals tMeals) {
        this.tMealsMapper.updateByPrimaryKey(tMeals);
    }

    @Override
    public void DeleteByPrimaryKey(TMeals tMeals) {
        this.tMealsMapper.deleteByPrimaryKey(tMeals);
    }
}
